package edu.spec.teacher.model;

import edu.spec.basic.model.User;
import edu.spec.basic.model.enumeration.SignInStatus;

import javax.persistence.*;
import java.util.Date;

/**
 * Author       : MadFrog
 * Date         : 2018/10/9 18:01
 * Description  : User和SignIn关联表，教工签到情况表
 */
@Entity
@Table(name = "t_user_signin")
public class UserSignIn {
    /**
     * 主键
     */
    private Integer id;
    /**
     * 用户
     */
    private User user;
    /**
     * 签到
     */
    private SignIn signIn;
    /**
     * 纬度
     */
    private Float latitude;
    /**
     * 经度
     */
    private Float longitude;
    /**
     * 请假说明
     */
    private String description;
    /**
     * 签到时间
     */
    private Date signInDate;
    /**
     * 签到结果
     */
    private SignInStatus verdict;

    public UserSignIn() {
    }

    public UserSignIn(User user, SignIn signIn) {
        this.user = user;
        this.signIn = signIn;
        this.verdict = SignInStatus.UNSIGNIN;
    }

    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name = "user_id")
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne
    @JoinColumn(name = "sign_in_id")
    public SignIn getSignIn() {
        return signIn;
    }

    public void setSignIn(SignIn signIn) {
        this.signIn = signIn;
    }

    public Float getLatitude() {
        return latitude;
    }

    public void setLatitude(Float latitude) {
        this.latitude = latitude;
    }

    public Float getLongitude() {
        return longitude;
    }

    public void setLongitude(Float longitude) {
        this.longitude = longitude;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "sign_in_date")
    public Date getSignInDate() {
        return signInDate;
    }

    public void setSignInDate(Date signInDate) {
        this.signInDate = signInDate;
    }

    public SignInStatus getVerdict() {
        return verdict;
    }

    public void setVerdict(SignInStatus verdict) {
        this.verdict = verdict;
    }
}
